include io.asm

stack segment stack
	dw 128 dup (?)
stack ends

;;======================================================================
data segment
	Head db "Vasilenko Anatoly. Group 111.$"
	Input db "Enter please number: $"
	Output db "Answer: $"
	
	number db 5 dup(' '), '$'
data ends
;;======================================================================

code segment 'code'
	assume ss:stack, ds:data, cs:code
start:
	mov ax,data
	mov ds,ax
	lea dx, Head
	outstr
	newline
	newline
	;;------------------------------------------------------------------
		lea dx, Input;
		outstr;
		
		inint ax;
		
		lea dx, Output;
		outstr;

		cmp ax, 0;
		jge next1;
		outch '-';
		neg ax;
		next1:
		
		mov bx, 4;
		L:	mov dx, 0;
			mov cx, 10;
			div cx;
			add dl, '0';
			mov number[bx], dl;
			dec bx;
			
			cmp ax, 0;
			jne L;
		
		lea dx, number[bx +1];
		outstr;
	;;------------------------------------------------------------------

the_end:
	newline;
	newline;
	mov ah,8
	int 21h
    finish
code ends

;;======================================================================
end start 

;;======================================================================
